import 'package:get/get.dart';
import 'package:zootix/models/zt_user_info.model.dart';
import 'package:zootix/store/zt_im_chat.store.dart';
import 'package:zootix/apis/zt-api.dart' as Api;

class ZtConversationItemController extends GetxController {
  late String userId;
  ZtConversationItemController(this.userId);
  final userInfo = Rx<ZtUserInfoModel>(ZtUserInfoModel());
  @override
  void onInit() {
    getUserInfo();
    super.onInit();
  }

  @override
  void onClose() {
    super.onClose();
  }

  Future<void> getUserInfo() async {
    final response = await Api.getUserInfo(userId);
    if (response.data != null) {
      userInfo(ZtUserInfoModel.fromJson(response.data['data']));
    }
  }
}
